import React,{ useState,useEffect,useRef } from 'react';

function Course(){

    const [ course,setCourse ] = useState("123");
    const [ num,setNum ] = useState(1);

    useEffect(()=>{
        console.log("zu jian gua zai")
        return () => {
            console.log("qing li geng xin qian")
        }
    },[num,course]);

    return <div>
        <div>
            xuanze kecheng
            { course }
            <select 
                value={ course }
                onChange = {({target})=>{ setCourse(target.value); }}
            >
                <option value="web1">web1</option>
                <option value="web2">web2</option>
            </select>
        </div>
        <div>
            gou mai shu liang
            <input 
              type="number" 
              value={num}
              min={1}
              onChange={ ({target})=>{setNum(Number(target.value))} }
            />
        </div>
    </div>

}

export default Course;